import request from '@/utils/request';
import { AxiosPromise } from 'axios';

export interface IndexStatistics {
  addressCount: string;
  dailyVolume: string;
  twitterMentions: string;
  telegramMembers: string;
  newTelegramMembers: string;
}

export interface TokenInfo {
  currentPrice: string;
  priceChange: string;
  totalSupply: string;
  circulatingSupply: string;
  marketCap: string;
  marketSentiment: string;
}

export interface Activity {
  time: string;
  event: string;
  value: string;
}

export interface News {
  id: number;
  title: string;
  time: string;
}

export interface ChartData {
  dates: string[];
  volumeData: number[];
  communityData: number[];
}

/**
 * 获取首页统计数据
 */
export function getIndexStatistics(): AxiosPromise<IndexStatistics> {
  return request({
    url: '/system/index/statistics',
    method: 'get'
  });
}

/**
 * 获取代币信息
 */
export function getTokenInfo(): AxiosPromise<TokenInfo> {
  return request({
    url: '/system/index/token',
    method: 'get'
  });
}

/**
 * 获取最新活动
 */
export function getActivities(): AxiosPromise<Activity[]> {
  return request({
    url: '/system/index/activities',
    method: 'get'
  });
}

/**
 * 获取最新公告
 */
export function getNews(): AxiosPromise<News[]> {
  return request({
    url: '/system/index/news',
    method: 'get'
  });
}

/**
 * 获取图表数据
 */
export function getChartData(): AxiosPromise<ChartData> {
  return request({
    url: '/system/index/chart',
    method: 'get'
  });
}